﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Code;
using github.heerheer.card2.UI.ViewModels;
using HeerCards.Helper;
using Panuon.UI.Silver;

namespace github.heerheer.card2.UI.Views
{
    /// <summary>
    /// ProHubView.xaml 的交互逻辑
    /// </summary>
    public partial class ProHubView : UserControl
    {
        ProHubViewModel ProHubViewModel { get; set; }
        public ProHubView()
        {
            InitializeComponent();
            this.DataContext = ProHubViewModel=new ProHubViewModel();
        }
        private void Btn_SaveProSettings(object sender, RoutedEventArgs e)
        {
        }
        private void Btn_PleaseUpdate(object sender, RoutedEventArgs e)
        {
            if (AppMain.VipInfo.Coin >= 20)
            {
                Native.Tool.Http.HttpWebClient.Get($"http://customcard.heerdev.top/coin.php?code={AppMain.VipInfo.Code}&cost=20&qq={AppMain.Common.GetLoginQQId()}");
                MessageBox.Show("花费了20女装币，催更成功！");
                AppMain.Common.SendPrivateMessage(1767407822, "请...请更新...等不及啦！");
                AppMain.VipInfo = VIPHelper.checkVIP(AppMain.Common.GetLoginQQId().ToString(),AppMain.VipInfo.Code);
                ProHubViewModel = new ProHubViewModel();

            }
        }
        private void Btn_ClearImageTemp(object sender, RoutedEventArgs e)
        {

            var path = AppMain.Common.AppDirectory.Replace("app\\github.heerheer.card2", "image\\card2\\temp");
            int i = 0;
            if (Directory.Exists(path))
            {
                Directory.GetFiles(path).ToList<string>().ForEach(s => { File.Delete(s); i++; });

            }
            MessageBoxX.Show($"清理了{i}个缓存图片", "清理成功");
        }
    }
}
